import React, {Component} from 'react';
import {Button} from "antd";

class setStateDemo extends Component {
    state={count:0}
    add= ()=>{
        const {count} = this.state
        this.setState({count:count+1})
    }
    render() {
        return (
            <div>
                <h2>当前值为：{this.state.count}</h2>
                <Button onClick={this.add}>点我+1</Button>
                setStateDemo
            </div>
        );
    }
}

export default setStateDemo;